package com.xianggu;

import com.xianggu.demo.dto.UserDto;
import com.xianggu.spring.MyExtension;
import com.xianggu.spring.XiangGuApplicationContent;
import com.xianggu.spring.annotation.Component;
import com.xianggu.spring.annotation.ComponentScan;
import com.xianggu.spring.expand.ExtensionRegistry;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.List;

/**
 * @author chengjy
 * @date 2025/3/8
 */
@ComponentScan(paths = {"com.xianggu.common","com.xianggu"})
@Component
public class Consumer {
    public static void main(String[] args) {

        // 注册feign代理对象
//        ExtensionRegistry.registerExtension(new MyExtension());
        XiangGuApplicationContent applicationContent = new XiangGuApplicationContent(Consumer.class);
        System.out.println("容器初始化完成");

        XiangGuController controller = (XiangGuController) applicationContent.getBean("xiangGuController");
        List<UserDto> userDtos = controller.test("admin");
        System.out.println("本次查询数据："+ userDtos.size() + "条");

        for (int i = 0; i < userDtos.size(); i++) {
//            System.out.println(userDtos.get(i));
        }

        System.out.println(controller.doService("摩西摩西！！"));

    }
}
